package adara.plugins;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class PluginManager {

	private static PluginManager instance = null;
	
	private Map<String, IPlugin> pluginsMap;
	
	private PluginManager() {
		pluginsMap = new HashMap<String, IPlugin>();
	}
	
	public static Collection<IPlugin> getPlugins() {
		return instance().pluginsMap.values();
	}
	
	public static PluginManager instance() {
		if (instance == null) {
			synchronized (PluginManager.class) {
				if (instance == null) {
					instance = new PluginManager();
				}
			}
		}
		
		return instance;
	}
}
